In a vehicle having an internal combustion engine as a drive source, the ignition timing is controlled in accordance with the operating state of the engine. Basically, the ignition timing control involves setting a control target value for an ignition timing based on the operating state of the engine. The control target value is corrected using a feedback correction term that is updated depending on whether knocking has occurred. If knocking occurs, the feedback correction term is changed by the amount corresponding to a predetermined retardation update amount in order to retard the ignition timing. When knocking does not occur, the feedback correction term is changed by the amount corresponding to a predetermined advance update amount so as to advance the ignition timing. The control target is corrected using a learned value updated based on the feedback correction term. The learned value is, for example, a value obtained by performing a gradual change procedure on the feedback correction term.
For example, Patent Document 1 discloses a controller of an internal combustion engine that sets a first learned value and a second learned value. The first learned value is used for compensating for a change amount of the ignition timing caused by time-dependent change of the engine (which is, for example, deposit formation in the combustion chamber of the engine). The second learned value is used for compensating for a change amount of the ignition timing caused by a factor other than the aforementioned change of the engine (which is, for example, change of fuel properties).
In the controller described in Patent Document 1, learning of the first learned value is permitted in a first engine operating range, in which the deposit formation in the engine combustion chamber influences the ignition timing to a great extent. Contrastingly, such learning is prohibited in a second engine operating range, in which the influence of the deposit formation in the engine combustion chamber on the ignition timing is limited. As a result, a value corresponding to a change amount of the ignition timing caused by the aforementioned deposit formation is learned as the first learned value. Also, a value corresponding to a change amount of the ignition timing caused by a factor other than the deposit formation is learned as the second learned value. In this manner, the ignition timing is controlled in correspondence with factors causing knocking.
For example, high-octane gasoline may be fed to a fuel tank that has retained regular fuel. In this case, the fuel supplied to the engine has properties different from the properties of the originally retained fuel. In other words, when fuel having properties different from the properties of currently retained fuel is fed to the fuel tank, the fuel received by the engine has properties different from the properties of the currently retained fuel. In this case, the occurrence state of knocking changes, and the feedback correction term changes greatly.
In this case, if the learning of the first learned value is selectively permitted and prohibited simply in accordance with the operating state of the engine, the following problem may occur. Specifically, when the engine is operated in the first engine operating range immediately after refueling, the first learned value reflects the ignition timing (the feedback correction term) that has been greatly changed by the fuel having different properties. This hinders the first learned value and the second learned value from being accurately learned in correspondence with the target of compensation.    Patent Document 1: Japanese Laid-Open Patent Publication No. 2005-147112